package com.zzccyy.jpdemo.utils;

import android.app.Activity;
import android.content.Context;
import android.text.TextUtils;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zzccyy.jpdemo.R;
import com.zzccyy.jpdemo.bean.SearchListBean;

import java.util.List;


public class ListAdapter2 extends BaseQuickAdapter<SearchListBean.DataBean.ListBean.TicketListBean, BaseViewHolder> {


    private final Context activity;



    public ListAdapter2(Context activity, List<SearchListBean.DataBean.ListBean.TicketListBean> list, int layoutResId) {
        super(layoutResId,list);
        this.activity = activity;
    }
    
    @Override
    protected void convert(BaseViewHolder helper, SearchListBean.DataBean.ListBean.TicketListBean item) {
        TextView tvTitle = helper.getView(R.id.tvTitle);
        TextView tvContent = helper.getView(R.id.tvContent);
        if (!TextUtils.isEmpty(item.name)){
            tvTitle.setText(item.name +":");
        }
        if (!TextUtils.isEmpty(item.num)){
            tvContent.setText(item.num);
            if (item.num.equals("无")){
                tvContent.setTextColor(ContextCompat.getColor(activity, R.color.color_999999));
            }else {
                tvContent.setTextColor(ContextCompat.getColor(activity, R.color.color_4ece43));
            }
        }
    }
}

